#ifndef TYPES_H_
#define TYPES_H_

#include <assert.h>
#include <inttypes.h>
#include "program.h"
#include "CuVector.h"
#include "CuDebug.h"

enum Mode {
	Constant,
	Public,
	Private,
};
__device__ Mode calcMode(Mode mode1, Mode mode2);
__device__ CuString modeText(Mode mode);

//type
__device__ int typeBitSize(int m_type);
__device__ bool typeIsSign(int m_type);
__device__ bool typeIsInteger(int m_type);
__device__ CuString typeName(int m_type);

__device__ int toRustType(int t);

class Boolean
{
public:
	__device__ static Boolean constant(bool flag);
	__device__ static Boolean create(Mode mode,bool flag);

	__device__ Boolean();
	__device__ bool is_constant() const;
	__device__ CuString toString() const;

	__device__ Boolean operator!() const;

	Mode mode;
	bool value;
};
__device__ CuDebug operator<<(CuDebug dbg, const Boolean& b);

typedef CuVector<Boolean> BitArray;
__device__ Mode bitArrayMode(const BitArray &list);

__device__ CuByteArray bits_to_bytes_le(const BitArray& buffer);
__device__ BitArray bytes_to_bits_le(const CuByteArray& buffer);

#endif // !TYPES_H_
